<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="./js/jquery.min.js"></script>
		<script type="text/javascript">
		   $(function(){
			   $("#btn").click(function(){//给提交按钮添加单击事件
				    //获取账号和密码
				   var name = $("#name").val();
				   var pwd = $("#pwd").val();
				    alert(name+"     "+pwd);
				   $.ajax({
					  url:"http://127.0.0.1:8080/temo/CustomerServlet",
					   method:"post",
					  data:{"method":"login","name":name,"pass":pwd},
					  // data:{"name":name,"pass":pwd},
					  dataType:"json",
					   success:function(result){
						    $("#msg").html(result.msg);
						   //console.log(result.code);
						   // if(result.code==200){
							  //  //登录成功，获取token，显示在span
							  //  $("#msg").html(result.token);
						   // }else if(result.code==500){
							  // //登录失败，msg显示在span
							  // $("#msg").html(result.msg);
						   // }
					   }
				   });
			   })
		   })
		</script>
	</head>
	<body>
	  <span id="msg"></span>
	  <form action="" method="post" onsubmit="return false;">
	     账号：<input type="text" id="name" value=""/><br/>
		 密码：<input type="password" id="pwd" value=""/><br/>
		<button id="btn">提交</button>
	</form>
	  
	
	</body>
</html>
